<?php
declare(strict_types=1);
namespace Field;

class AuthNickAuthLogConst
{
    public const pk='AuthLogID';
    public const index=['AuthLogID'];
	public const fields=['AuthLogID','NickID','ProductID','VoucherID','CreateAt','IsDelete','OrderID','AddDay','UserID','IsFree','TimeAt','UpdateAt'];
	public const comment=['AuthLogID'=>'日志记录','NickID'=>'授权编号','ProductID'=>'产品编号','VoucherID'=>'','CreateAt'=>'创建时间','IsDelete'=>'删除标记','OrderID'=>'订单号','AddDay'=>'增加时间，取消订单为负数 减少时间','UserID'=>'用户编号','IsFree'=>'免费赠送','TimeAt'=>'截止时间','UpdateAt'=>'更新时间'];
	/*
    * @Field AuthLogID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 日志记录
    */
    public const AuthLogID = 'AuthLogID';
    /*
    * @Field NickID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 授权编号
    */
    public const NickID = 'NickID';
    /*
    * @Field ProductID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 产品编号
    */
    public const ProductID = 'ProductID';
    /*
    * @Field VoucherID
    * @Type int(10)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const VoucherID = 'VoucherID';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null NO
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 创建时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field IsDelete
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 删除标记
    */
    public const IsDelete = 'IsDelete';
    /*
    * @Field OrderID
    * @Type varchar(20)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key MUL
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 订单号
    */
    public const OrderID = 'OrderID';
    /*
    * @Field AddDay
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 增加时间，取消订单为负数 减少时间
    */
    public const AddDay = 'AddDay';
    /*
    * @Field UserID
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户编号
    */
    public const UserID = 'UserID';
    /*
    * @Field IsFree
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 免费赠送
    */
    public const IsFree = 'IsFree';
    /*
    * @Field TimeAt
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 截止时间
    */
    public const TimeAt = 'TimeAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 更新时间
    */
    public const UpdateAt = 'UpdateAt';
}

class AuthNickAuthLogColumns
{
public  int $AuthLogID;
   public  int $NickID;
   public  int $ProductID;
   public  int $VoucherID=0;
   public  string $CreateAt;
   public  int $IsDelete=0;
   public  ?string $OrderID='';
   public  int $AddDay=0;
   public  int $UserID=0;
   public  int $IsFree=0;
   public  int $TimeAt=0;
   public  ?string $UpdateAt='';
	public function toArray():array
	{
		return [
'AuthLogID'=>$this->AuthLogID,
    'NickID'=>$this->NickID,
    'ProductID'=>$this->ProductID,
    'VoucherID'=>$this->VoucherID,
    'CreateAt'=>$this->CreateAt,
    'IsDelete'=>$this->IsDelete,
    'OrderID'=>$this->OrderID,
    'AddDay'=>$this->AddDay,
    'UserID'=>$this->UserID,
    'IsFree'=>$this->IsFree,
    'TimeAt'=>$this->TimeAt,
    'UpdateAt'=>$this->UpdateAt,        ];
	}
}

class AuthNickAuthLogRow
{
	public AuthNickAuthLogColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'AuthLogID' => $this->data->AuthLogID,
        'NickID' => $this->data->NickID,
        'ProductID' => $this->data->ProductID,
        'VoucherID' => $this->data->VoucherID,
        'CreateAt' => $this->data->CreateAt,
        'IsDelete' => $this->data->IsDelete,
        'OrderID' => $this->data->OrderID,
        'AddDay' => $this->data->AddDay,
        'UserID' => $this->data->UserID,
        'IsFree' => $this->data->IsFree,
        'TimeAt' => $this->data->TimeAt,
        'UpdateAt' => $this->data->UpdateAt, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new AuthNickAuthLogColumns();
        isset($data['AuthLogID']) && $this->data->AuthLogID = (int)$data['AuthLogID'];
           isset($data['NickID']) && $this->data->NickID = (int)$data['NickID'];
           isset($data['ProductID']) && $this->data->ProductID = (int)$data['ProductID'];
           isset($data['VoucherID']) && $this->data->VoucherID = (int)$data['VoucherID'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['IsDelete']) && $this->data->IsDelete = (int)$data['IsDelete'];
           isset($data['OrderID']) && $this->data->OrderID = (string)$data['OrderID'];
           isset($data['AddDay']) && $this->data->AddDay = (int)$data['AddDay'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['IsFree']) && $this->data->IsFree = (int)$data['IsFree'];
           isset($data['TimeAt']) && $this->data->TimeAt = (int)$data['TimeAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
    }
}
?>